use std::io;
use std::fmt;

struct Person {
	age: i8,                //不同于C语言这里不用分号用逗号
	name: String,
}

impl fmt::Display for Person {
	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
		write!(f,"The age of {} is {}",self.name,self.age)
    }
}

#[derive(Debug)]
enum  Color {
	WHITE,BLACK,RED
}

type Sequence = i32;

enum PlayMessage {
	Pass,
	PlayAt(i32,i32,Color),
	ResignAt(Sequence),
	CountAt(Sequence)
}

fn main() {
	let me = Person {age: 18,name: "gerry xiao".to_string()};
	println!("{}",me);
	let mut lis: Vec<Person> = Vec::new();
	lis.push(me);
	let mess = PlayMessage::PlayAt(32,213,Color::WHITE);
	match mess {
		PlayMessage::PlayAt(x,y,z) => println!("oops you have played {:?} stone at ({},{})",z,x,y),
		_ => println!("haha,you are winning!")
	}
}